1 Public Class FrmUNIT_MEASURE_ADD
2
3     Private Sub cmdcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.Click
4         Me.Close()
5     End Sub
6
7     Private Sub cmdsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.Click
8         If Split(Me.Text,
" - ")(1) = "Add" Then
9             sqlSTR =
"INSERT INTO TBL_Unit_Measure (Code, Description) " & _
10                      
"VALUES ('" & txtcode.Text & "', " & _
11                              
"'" & txtdescription.Text & "')"
12             ExecuteSQLQuery(sqlSTR)
13             Audit_Trail(xUser_ID, TimeOfDay,
"Add New Unit Measure")
14         Else
15             sqlSTR =
"UPDATE TBL_Unit_Measure SET Code ='" & txtcode.Text & "', " & _
16                                               
"Description ='" & txtdescription.Text & "' WHERE ID=" & txtid.Text
17             ExecuteSQLQuery(sqlSTR)
18             Audit_Trail(xUser_ID, TimeOfDay,
"Edit Unit Measure")
19         End If
20
21         MsgBox(
"Record successfuly updated !!!", MsgBoxStyle.Information, "Sales and Inventory")
22         sqlSTR =
"SELECT * FROM TBL_Unit_Measure"
23         FillListView(ExecuteSQLQuery(sqlSTR), FrmUNIT_MEASURE.lstunit,
0)
24         Me.Close()
25     End Sub
26
27     Private Sub FrmUNIT_MEASURE_ADD_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
28         Me.Text =
"Unit Measure"
29     End Sub
30
31     Private Sub FrmUNIT_MEASURE_ADD_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
32         Dim stockid As Integer
33         stockid = globalID
34         If Split(Me.Text,
" - ")(1) = "Edit" Then
35             sqlSTR =
"SELECT * FROM TBL_Unit_Measure WHERE ID =" & stockid
36             ExecuteSQLQuery(sqlSTR)
37             txtid.Text = sqlDT.Rows(
0)("ID")
38             txtcode.Text = sqlDT.Rows(
0)("Code")
39             txtdescription.Text = sqlDT.Rows(
0)("Description")
40         Else
41             txtcode.Text =
""
42             txtid.Text =
""
43             txtdescription.Text =
""
44         End If
45
46     End Sub
47 End Class


Gõ tìm kiếm nhanh...